<?php

class Nanny {

    public static function find($arr = array()){
        global $db ;

        if(empty ($arr)){
            $query = $db->prepare("SELECT id, prenom, nom, surnom FROM nanny");
        } else if ($arr['id']){
            $query = $db->prepare("SELECT id, prenom, nom, surnom FROM nanny WHERE id=:id");
        } else {
            throw new Exception("Unsupported property !");
        }

        $query->execture($arr);

        return $query->fetchAll(PDO::FETCH_CLASS, "Nanny");
    }


}
?>
